package com.situ.javase.week3.Day1;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class BorderLayoutDemo {
		
		
		public static void main(String[] args) {
			 // 创建JFrame
		     JFrame frame = new JFrame("FlowLayoutDemo");
		     JPanel panel = new JPanel();
		     frame.add(panel);
		     // 设置布局管理器
		     panel.setLayout(new BorderLayout());
		     //创建组件
		     JButton northButton = new JButton("北丐");
		     JButton southButton = new JButton("南帝");
		     JButton westButton = new JButton("西毒");
		     JButton eastButton = new JButton("东邪");
		     JButton centerButton = new JButton("中神通");
		     panel.add(northButton, BorderLayout.NORTH);
		     panel.add(southButton, BorderLayout.SOUTH);
		     panel.add(westButton, BorderLayout.WEST);
		     panel.add(eastButton, BorderLayout.EAST);
		     panel.add(centerButton, BorderLayout.CENTER);
		     // 设置大小,单位是像素
		     frame.setSize(400, 300);
		     // 设置初始位置
		     frame.setLocation(500, 200);
		     // 默认是不显示
		     frame.setVisible(true);
		     // 关闭Frame(设置Frame默认关闭时候的操作，就是当关闭时候退出)
		     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		   }
}
